#pragma once


/*
CurrentThread主要就是为了获得当前线程的id和获取调用堆栈,Thread封装了创建线程及相关的api
CurrentThread.h中声明的一些函数在Thread.cpp中定义，两者关系紧密
*/
namespace CurrentThread {
	extern __thread int t_cachedTid;
	extern __thread char t_tidString[32];
	extern __thread int t_tidStringLength;
	extern __thread const char* t_threadName;
	void cacheTid();
	inline int tid() {
		cacheTid();
		return t_cachedTid;
	}
	inline const char* tidString(){
		return t_tidString;
	}
	inline int tidStringLength(){
		return t_tidStringLength;
	}
	inline const char* name(){
		return t_threadName;
	}
}